package leetCode;

import java.util.ArrayList;

/**
 * @author Sven
 * @Desc
 * @date 3/21/22 14:11
 */
public class AddTwoSum {

    static class Solution {
        public ListNode swapPairs(ListNode head) {
            if (head == null) {
                return null;
            }
            if (head.next == null) {
                return head;
            }
            ListNode node = head;
            while (node.next != null) {
                int tmp = head.val;
                head.val = head.next.val;
                head.next.val = tmp;
                node = node.next.next;
            }
            return head;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

}



    /*
    作者：LeetCode-Solution
    链接：https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-leetcode-solution/
    来源：力扣（LeetCode）
    著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。
    */

